/*
*************************************
* PocketGTT
*************************************
This file is part of PocketGTT.

PocketGTT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

PocketGTT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PocketGTT.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <QtGui/QApplication>
#include <QtDeclarative>
#include <QDeclarativeContext>
#include "qmlapplicationviewer.h"
#include "src/gtt_stopmanager.h"

Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));
    QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());


    // force Portrait orientation
    viewer->setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);

    // export to QML the GTT infos
    QDeclarativeContext *ctx = viewer->rootContext();
    GTT_StopManager *myGTT = new GTT_StopManager(ctx);
    ctx->setContextProperty("GTT", myGTT);


    // provo a registrare GTTfermata
    qmlRegisterType<GTT_Stop>("myGTT", 1, 0, "GTTfermata");
    qmlRegisterType<GTT_StopManager>("myGTT", 1, 0, "GTTstopManager");


    // make it all visible :)
    viewer->setMainQmlFile(QLatin1String("qml/PocketGTT/MainWindow.qml"));

//    #ifdef Q_OS_SYMBIAN
//    if (QSysInfo::s60Version() == QSysInfo::SV_S60_5_0) {
//            app->setNavigationMode(QT::);
//        }
//    #endif


#ifdef Q_WS_MAEMO_5
    //    viewer->showFullScreen();
    viewer->show();
#else
    viewer->showExpanded();
//            show();
//            viewer->show();
#endif

    return app->exec();
}
